First time DXL user here... I'm trying to count objects with incoming links, however it returns "0", probably because the incoming links are external links. Is there any way to use hasLinks on external links, or will I have to count them another way? Module m = current int i0, j0, i1, j1, i2, j2, i3, j3 Filter f0 = contains (attribute "Object Heading", "confirm", false) || contains (attribute "Object Heading", "verify", false) Filter f1 = hasLinks(linkFilterOutgoing, "*") Filter f2 = hasLinks(linkFilterIncoming, "*") Filter f3 = f1 && f2 set (m, f0, i0, j0) set (m, f1, i1, j1) set (m, f2, i2, j2) set (m, f3, i3, j3) filtering on print "Objects containing \"Confirm\" or \"Verify\" = " i0 "\n" print "Objects with a requirement (outgoing) link = " i1 "\n" print "Objects with a verification (incoming) link = " i2 "\n" print "Objects with both incoming and outgoing links = " i3 "\n" int diff = i2 - i3 print "Objects with a verification (incoming) link, but no requirement (outgoing) link = " diff "\n" filtering off
SystemAdmin - Wed Jun 23 09:07:41 EDT 2010 |
Re: Can you use hasLinks on External links?
I can safely say I've NEVER used this sort of filtering to do anything with DXL. The main reason, of course, is that you have to open the module visibly to do it, which takes drastically longer than opening invisible, and takes up resources.
bool ObjectHasDoorsLinks(Object obj)
{ if (null obj) return(false)
Link lnk
LinkRef lr
for lnk in obj ->"*" do {return(true)}
for lr in obj <-"*" do {return(true)}
return(false) // none found
}
int CountModule(Module mod)
{ if (null mod) return(0)
int Count = 0
Object obj
for obj in entire (mod) do
{ if (isDeleted(obj)) continue // don't count links on deleted objects
if (ObjectHasDoorsLinks(obj)) Count++
}
return(Count)
}
|
Re: Can you use hasLinks on External links? llandale - Wed Jun 23 17:11:42 EDT 2010
I can safely say I've NEVER used this sort of filtering to do anything with DXL. The main reason, of course, is that you have to open the module visibly to do it, which takes drastically longer than opening invisible, and takes up resources.
bool ObjectHasDoorsLinks(Object obj)
{ if (null obj) return(false)
Link lnk
LinkRef lr
for lnk in obj ->"*" do {return(true)}
for lr in obj <-"*" do {return(true)}
return(false) // none found
}
int CountModule(Module mod)
{ if (null mod) return(0)
int Count = 0
Object obj
for obj in entire (mod) do
{ if (isDeleted(obj)) continue // don't count links on deleted objects
if (ObjectHasDoorsLinks(obj)) Count++
}
return(Count)
}
Basically, once a week my lead looks at these number and updates his metric, and he has the module open anyway. I'll still leave the question open for a day or two in case anyone has an answer to the original question. Again, thanks for the help. |
Re: Can you use hasLinks on External links? SystemAdmin - Thu Jun 24 08:25:08 EDT 2010
Here's what I ended up doing:
Module m = current
Object o
ExternalLink ExtLnk
Link outLnk
int numOutLinks=0, numExtLinks=0, outCount=0, extCount=0, both=0
int test1 = 0, test2 = 0
for o in m do
{
for outLnk in o -> "*" do
{
numOutLinks++
}
if (numOutLinks>0)
{
outCount++
test1 = 1
}
else test1 = 0
numOutLinks = 0
for ExtLnk in o <- "*" do
{
numExtLinks++
}
if (numExtLinks>0)
{
extCount++
test2 = 1
}
else test2 = 0
numExtLinks = 0
if (test1==1 && test2==1) both++
}
print "Objects with a requirement (outgoing) link = " outCount "\n"
print "Objects with a verification (incoming) link = " extCount "\n"
print "Objects with both outgoing and incoming links = " both ""
int leafCount = 0
for o in m do
{
if (leaf (o)==true)
leafCount++
}
|
Re: Can you use hasLinks on External links? |
Re: Can you use hasLinks on External links? to derive a filter of what I want to see. I then look at the Statistics Total Objects: Accepted: Rejected: filtering statistics that DOORS presents in the dialog box. I just have to be able to define a filter. |
Re: Can you use hasLinks on External links? SystemAdmin - Thu Jun 24 11:44:26 EDT 2010 can you please elaborate how did you achieve external link filter. i need to set a filter of external links on a module like the one below which works for the outgoing links within DOORS
Filter f = hasLinks(linkFilterOutgoing, "*") |